import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:xiongmao_clean_flutter_module/res/gaps.dart';

import '../../../../res/colors.dart';
import '../../../../widgets/custom_switch.dart';
import '../item/Insure_history_listview.dart';
import '../item/Insure_listview.dart';
import '../item/Insure_personnel_listview.dart';

/**
 * 保险商城
 */
class InsureMarketPage extends StatefulWidget {
  @override
  _InsureMarketPageState createState() => _InsureMarketPageState();
}

class _InsureMarketPageState extends State<InsureMarketPage> {

  bool _isChecked = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              child: Container(
                color: Colours.base_primary_bg_page,
                child: Column(
                  children: [
                    //保险详情
                    InsureListView(),
                    BrnTextSelectFormItem(
                      title: "选择项目",
                      isRequire: true,
                      onTap: () {
                        BrnToast.show("点击触发回调_onTap", context);
                      },
                    ),
                    BrnTextSelectFormItem(
                      title: "选择成员",
                      isRequire: true,
                      onTap: () {
                        BrnToast.show("点击触发回调_onTap", context);
                      },
                    ),
                    //参保人员
                    InsurePersonnelListView(),
                    //提示语
                    Padding(
                      padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
                      child: Text(
                        "1.营业执照名称与劳务合同签章名称必须保持一致，否则不予理赔。\n2.商业保洁责任险(熊猫)由XXX承保，购买、自动续保后次日零时生效。\n3.项目成员离职将自动退保，并在下一位成员入职后自动续保。\n4.本保险将生成电子保单和电子发票，分享和打印同样具有法律效力。\n5.本保险理赔时，为全流程在线理赔，方便快速赔付.",
                        style: TextStyle(fontSize: 10, color: Colors.grey),
                      ),
                    )
                  ],
                ),
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.only(left: 10, right: 10, top: 10),
            margin: EdgeInsets.only(bottom: 10),
            // 底部悬浮视图的高度
            color: Colors.white,
            // 底部悬浮视图的背景颜色
            child: Column(
              children: [
                Row(
                  children: [
                    Container(
                      width: 20,
                      height: 20,
                      decoration: BoxDecoration(
                        shape: BoxShape.circle,
                        border: Border.all(color: Colors.green),
                        color: _isChecked ? Colors.green : Colors.transparent,
                      ),
                      child: _isChecked
                          ? Icon(
                        Icons.check,
                        color: Colors.white,
                        size: 16,
                      )
                          : null,
                    ),
                    SizedBox(width: 10),
                    Text(
                      "我已阅读并同意",
                      style: TextStyle(fontSize: 14),
                    ),
                    Flexible(
                      child: Row(
                        children: [
                          GestureDetector(
                            onTap: () {
                              // 点击《投保须知》的操作
                            },
                            child: Text(
                              "《投保须知》",
                              style: TextStyle(fontSize: 14, color: Colors.green),
                            ),
                          ),
                          Text(
                            "、",
                            style: TextStyle(fontSize: 14),
                          ),
                          GestureDetector(
                            onTap: () {
                              // 点击《保险条款》的操作
                            },
                            child: Text(
                              "《保险条款》",
                              style: TextStyle(fontSize: 14, color: Colors.green),
                            ),
                          ),
                          Text(
                            "和",
                            style: TextStyle(fontSize: 14),
                          ),
                          GestureDetector(
                            onTap: () {
                              // 点击《委托书&告知书》的操作
                            },
                            child: Text(
                              "《委托书&告知书》",
                              style: TextStyle(fontSize: 14, color: Colors.green),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
                BrnBigMainButton(
                  bgColor: Colours.base_primary_green,
                  title: '支付',
                  onTap: () {
                    BrnToast.show('点击', context);
                  },
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
